﻿var thisWidget;

//当前页面业务
function initWidgetView(_thisWidget) {
    thisWidget = _thisWidget;
    if (thisWidget.config && thisWidget.config.style) {//适应不同样式
        $("body").addClass(thisWidget.config.style);
    }
    //绘制区域按钮
    $("#btnDraw").click(function () {
        thisWidget.analyDeal()
    });
    //开始分析按钮
    $("#begin").click(function () {
        if (thisWidget.drawEntity == null) {
            haoutil.msg('请首先绘制分析区域！');
            return false;
        }
        $("#paramView").hide();
        $("#resultView").show();
        var minValue = Number($("#minHeight").val());
        var maxValue = Number($("#maxHeight").val());
        var speed = Number($("#speed").val())
        thisWidget.floodControl.start(thisWidget.drawEntity, {
            height: minValue,
            maxHeight: maxValue,
            speed: speed,
            onChange: function (height) {
                $("#msg").html('当前高度：' + height.toFixed(1));
            },
            onStop: function () {
                $("#msg").html('已完成分析');
            }
        });
    });
    //清除
    $("#clear").click(function () {
        $("#resultView").hide();
        $("#paramView").show();
        $("#msg").html('');
        thisWidget.clearBtn()
    });

}
function minAndMaxHeight(result) {
    $("#minHeight").val(result.minHeight.toFixed(1));
    $("#maxHeight").val(result.maxHeight.toFixed(1));
}